<?php

use Biz\service\salesRebate\SalesRebate as sSalesRebate;

class AddApplyAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_REALNAME;

    public function main()
    {
        $uid = $this->uid;
        $amount = $this->getRequest()->getPost('amount', '');
        $type = $this->getRequest()->getPost('type', '');

        if ($apply = sSalesRebate::createBill($uid, $type, $amount)) {
            $result['apply'] = $apply;
            $this->setSuccess($result);
        } else {
            throw new \Exception('申请提现失败');
        }
    }
}